package templates

import "html/template"

//ReportingInfo fills the templates listed in html/template
type ReportingInfo struct {
	DB     string
  LogsGeneratedAt string
	Writer template.HTML
}

var activecmImg = "<img src=\" \" alt=\"Active Countermeasures\" style=\"width:75px; float:left\" />"

var dbHeader = `
<head>
<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
<meta content="utf-8" http-equiv="encoding">
<link rel="stylesheet" type="text/css" href="../style.css">
</head>

<ul>
  <a href="http://activecountermeasures.com/" target="_blank">
	` + activecmImg + `
  </a>
  <li><a href="../index.html">RITA</a></li>
  <li><a href="index.html">Viewing: {{.DB}}</a></li>
  <li><a href="beacons.html">Beacons</a></li>
  <li><a href="beaconsfqdn.html">Beacons FQDN</a></li>
    <li><a href="beaconsproxy.html">Beacons Proxy</a></li>
	<li><a href="strobes.html">Strobes</a></li>
	<li><a href="dns.html">DNS</a></li>
  <li><a href="bl-source-ips.html">BL Source IPs</a></li>
	<li><a href="bl-dest-ips.html">BL Dest. IPs</a></li>
	<li><a href="bl-hostnames.html">BL Hostnames</a></li>
	<li><a href="long-conns.html">Long Connections</a></li>
	<li><a href="useragents.html">User Agents</a></li>
  <li><a href="index.html">Time Generated: {{.LogsGeneratedAt}}</a></li>
	<li style="float:right">
    <a href="https://github.com/activecm/rita" target="_blank">RITA on
		<img src="../github.svg" title="Icon made by Dave Gandy from www.flaticon.com" id="github">
    </a>
  </li>
</ul>
`

var homeHeader = `
<head>
<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
<meta content="utf-8" http-equiv="encoding">
<link rel="stylesheet" type="text/css" href="./style.css">
</head>
<ul>
    <a href="http://activecountermeasures.com/" target="_blank">
		` + activecmImg + `
    </a>
  <li><a href="./index.html">RITA</a></li>
  <li style="float:right">
    <a href="https://github.com/activecm/rita" target="_blank">RITA on
		<img src="./github.svg" title="Icon made by Dave Gandy from www.flaticon.com" id="github">
    </a>
  </li>
</ul>
`

// Hometempl is our home template html
var Hometempl = homeHeader + `
<p>
  <div class="info">To view individual databases, click on any of the links below.</div>
  <div class="vertical-menu">
    {{range .}}
      <a href="{{.}}/index.html">{{.}}</a>
    {{end}}
  </div>
</p>
`

// DNStempl is our dns page template
var DNStempl = dbHeader + `
<div class="container">
  <table>
    <tr><th>Subdomain Count</th><th>Visited</th><th>Domain</th><tr>
    {{.Writer}}
  </table>
</div>
`

// DBhometempl is our database home template for each directory
var DBhometempl = dbHeader + `
<p>
  <div class="info">To view results, click on any of the links above.</div>
</p>
`

// BeaconsTempl is our beacons html template
var BeaconsTempl = dbHeader + `
<div class="container">
  <table>
  <tr><th>Score</th><th>Source</th><th>Destination</th><th>Connections</th><th>Avg. Bytes</th><th>
	Intvl. Range</th><th>Size Range</th><th>Intvl. Mode</th><th>Size Mode</th><th>Intvl. Mode Count</th>
	<th>Size Mode Count</th><th>Intvl. Skew</th><th>Size Skew</th><th>Intvl. Dispersion</th><th>Size Dispersion
	</th><th>Total Bytes</th>
	</tr>
      {{.Writer}}
  </table>
</div>
`

// BeaconsNetNamesTempl is our beacons html template with network names
var BeaconsNetNamesTempl = dbHeader + `
<div class="container">
  <table>
  <tr>
	<th>Score</th><th>Source Network</th><th>Destination Network</th><th>Source</th><th>Destination</th>
	<th>Connections</th><th>Avg. Bytes</th><th>Intvl. Range</th><th>Size Range</th><th>Intvl. Mode</th>
	<th>Size Mode</th><th>Intvl. Mode Count</th><th>Size Mode Count</th><th>Intvl. Skew</th><th>Size Skew</th>
	<th>Intvl. Dispersion</th><th>Size Dispersion</th><th>Total Bytes</th>
  </tr>
	{{.Writer}}
  </table>
</div>
`

// BeaconsFQDNTempl is our beaconsFQDN html template
var BeaconsFQDNTempl = dbHeader + `
<div class="container">
  <table>
  <tr><th>Score</th><th>Source</th><th>FQDN</th><th>Connections</th><th>Avg. Bytes</th><th>
	Intvl. Range</th><th>Size Range</th><th>Intvl. Mode</th><th>Size Mode</th><th>Intvl. Mode Count</th>
	<th>Size Mode Count</th><th>Intvl. Skew</th><th>Size Skew</th><th>Intvl. Dispersion</th><th>Size Dispersion
	</th></tr>
      {{.Writer}}
  </table>
</div>
`

// BeaconsFQDNNetNamesTempl is our beacons html template with network names
var BeaconsFQDNNetNamesTempl = dbHeader + `
<div class="container">
  <table>
  <tr>
	<th>Score</th><th>Source Network</th><th>Source</th><th>FQDN</th>
	<th>Connections</th><th>Avg. Bytes</th><th>Intvl. Range</th><th>Size Range</th><th>Intvl. Mode</th>
	<th>Size Mode</th><th>Intvl. Mode Count</th><th>Size Mode Count</th><th>Intvl. Skew</th><th>Size Skew</th>
	<th>Intvl. Dispersion</th><th>Size Dispersion</th>
  </tr>
	{{.Writer}}
  </table>
</div>
`

// BeaconsProxyTempl is our beaconsProxy html template
var BeaconsProxyTempl = dbHeader + `
<div class="container">
  <table>
  <tr><th>Score</th><th>Source</th><th>FQDN</th><th>Proxy</th><th>Connections</th>
  <th>Intvl. Range</th><th>Intvl. Mode</th><th>Intvl. Mode Count</th>
	<th>Intvl. Skew</th><th>Intvl. Dispersion</th></tr>
      {{.Writer}}
  </table>
</div>
`

// BeaconsProxyNetNamesTempl is our beacons html template with network names
var BeaconsProxyNetNamesTempl = dbHeader + `
<div class="container">
  <table>
  <tr>
  <tr><th>Score</th><th>Source Network</th><th>Source</th><th>FQDN</th><th><Proxy Network><th>Proxy</th>
  <th>Connections</th><th>Intvl. Range</th><th>Intvl. Mode</th><th>Intvl. Mode Count</th>
	<th>Intvl. Skew</th><th>Intvl. Dispersion</th></tr>
  </tr>
	{{.Writer}}
  </table>
</div>
`

//StrobesTempl is the strobes html template
var StrobesTempl = dbHeader + `
<div class="container">
  <table>
	<tr><th>Source</th><th>Destination</th><th>Connection Count</th></tr>
	  {{.Writer}}
	</table>
</div>
`

//StrobesNetNamesTempl is the strobes html template with network names
var StrobesNetNamesTempl = dbHeader + `
<div class="container">
  <table>
	<tr><th>Source Network</th><th>Destination Network</th><th>Source</th><th>Destination</th><th>Connection Count</th></tr>
	  {{.Writer}}
	</table>
</div>
`

// BLSourceIPTempl is our blacklisted source ip html template
var BLSourceIPTempl = dbHeader + `
<div class="container">
  <table>
  <tr><th>IP</th><th>Connections</th><th>Unique Connections</th><th>Total Bytes</th><th>Destinations</th><tr>
    {{.Writer}}
  </table>
</div>
`

// BLSourceIPNetNamesTempl is our blacklisted source ip html template with network names
var BLSourceIPNetNamesTempl = dbHeader + `
<div class="container">
  <table>
  <tr><th>IP</th><th>Network</th><th>Connections</th><th>Unique Connections</th><th>Total Bytes</th><th>Destinations</th><tr>
    {{.Writer}}
  </table>
</div>
`

// BLDestIPTempl is our blacklisted destination ip html template
var BLDestIPTempl = dbHeader + `
<div class="container">
  <table>
  <tr><th>IP</th><th>Connections</th><th>Unique Connections</th><th>Total Bytes</th><th>Sources</th><tr>
    {{.Writer}}
  </table>
</div>
`

// BLDestIPNetNamesTempl is our blacklisted destination ip html template with network names
var BLDestIPNetNamesTempl = dbHeader + `
<div class="container">
  <table>
  <tr><th>IP</th><th>Network</th><th>Connections</th><th>Unique Connections</th><th>Total Bytes</th><th>Sources</th><tr>
    {{.Writer}}
  </table>
</div>
`

// BLHostnameTempl is our blacklisted hostname html template
var BLHostnameTempl = dbHeader + `
<div class="container">
  <table>
  <tr><th>Hostname</th><th>Connections</th><th>Unique Connections</th><th>Total Bytes</th><th>Sources</th><tr>
    {{.Writer}}
  </table>
</div>
`

// LongConnsTempl is our long connections html template
var LongConnsTempl = dbHeader + `
<div class="container">
  <table>
	<tr><th>Source</th><th>Destination</th><th>DstPort:Protocol:Service</th><th>Duration</th></tr>
	  {{.Writer}}
	</table>
</div>
`

// LongConnsNetNamesTempl is our long connections html template with network names
var LongConnsNetNamesTempl = dbHeader + `
<div class="container">
  <table>
	<tr><th>Source Network</th><th>Destination Network</th><th>Source</th><th>Destination</th><th>DstPort:Protocol:Service</th><th>Duration</th></tr>
	  {{.Writer}}
	</table>
</div>
`

// UserAgentsTempl is our user agents html template
var UserAgentsTempl = dbHeader + `
<div class="container">
  <table>
	<tr><th>User Agent</th><th>Times Used</th></tr>
	  {{.Writer}}
	</table>
</div>
`
